package com.iOS.enums;

/**
 * @Author:WenTao
 * @Description:用户状态枚举类型
 * @Date:12:58 2018/9/20
 */
public enum UserInfoEnum {
    REPEAT_USERNAME(001, "用户名已存在")
    ,REPEAT_STUDENTID(002,"学号已存在")
    ,ERROR_PASSWORD(003,"密码错误")
    ,ERROR_USERNAME(004,"用户名不存在")
    ,INNER_ERROR(005,"服务器内部错误")
    ,SUCCESS(006,"操作成功")
    ,FAIL(07,"操作失败")
    ,PASSWORD_ERROR(000,"两次输入的密码不一致")
    ,ERROR_TOKEN(1,"token不存在");

    private int state;
    private String stateInfo;

    UserInfoEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    /*根据传入的state返回对应的enum*/
    public static UserInfoEnum stateof(int state) {
        for (UserInfoEnum stateEnum : values()) {
            if (stateEnum.getState() == state) {
                return stateEnum;
            }
        }
        return null;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }


}
